<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件练习</title>
</head>

<body>
    <p id="demo">点我</p>
    <script>
        p = document.getElementById("demo")
        p.onclick = function () {
            alert("我被点击了")
        }
    </script>
</body>

</html>
